﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LittleSolution
{
    public partial class frmDefineTeamplate : Form
    {
        public frmDefineTeamplate()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(tbxMessageName.Text))
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("You must enter Message Template Name before accept", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbxMessageName.Focus();
            }
        }
        public String MessageName
        {
            set
            {
                tbxMessageName.Text = value;
            }
            get
            {
                return tbxMessageName.Text;
            }
        }

        private void frmDefineTeamplate_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode==Keys.Escape)
            {
                this.DialogResult = DialogResult.Cancel;
                this.Close();
            }
            else if (e.KeyCode==Keys.Enter)
            {
                btnOK_Click(btnOK, null);
            }                            
        }
    }
}
